// $URL: http://mingw-lib.googlecode.com/svn/trunk/working/avcodec_to_widget_9/t_box_seek_manager.h $
// $Rev: 316 $
// $Author: akio.miyoshi $
// $Date:: 2010-07-31 05:43:58 +0000#$

#ifndef T_BOX_SEEK_MANAGER_H
#define T_BOX_SEEK_MANAGER_H

#include "stable.h"
#include "t_box.h"

class T_Box_Seek_Manager
    : public T_RecursiveLockedObject
    , public T_SlimpleWaitCondition
    , public T_AutoRunStopwatch
{
    Q_OBJECT
public:
    explicit T_Box_Seek_Manager()
        : m_max_timing(0)
    {
    }
    int pendingRequest();
    void enqueueRequest(int a_timing);
    int dequeueRequest();
    qint64 maxTiming();
    void registerTiming(qint64 a_timing);
protected:
    QQueue<int> m_request_queue;
    T_RecursiveAtomic m_request_mutex;
    qint64 m_max_timing;
};

#endif // T_BOX_SEEK_MANAGER_H
